#include "FreshBloodCalibrationForm.h"
#include "ui_FreshBloodCalibrationForm.h"



FreshBloodCalibrationForm::FreshBloodCalibrationForm(QWidget *parent) :
    IForm(parent),
    ui(new Ui::FreshBloodCalibrationWgt)
{
    ui->setupUi(this);
    init();
    mFreshBloodCalibration.doInit();
}

FreshBloodCalibrationForm::~FreshBloodCalibrationForm()
{
    delete ui;
}

void FreshBloodCalibrationForm::init()
{
    qRegisterMetaType<FreshBloodViewModel>("FreshBloodViewModel");
}

void FreshBloodCalibrationForm::unInit()
{

}

void FreshBloodCalibrationForm::showEvent(QShowEvent *)
{
    init();
    mFreshBloodCalibration.doInit();
}

void FreshBloodCalibrationForm::closeEvent(QCloseEvent *)
{
    mFreshBloodCalibration.doExit();
}

void FreshBloodCalibrationForm::closed()
{
    unInit();
    mFreshBloodCalibration.doUnInit();
}

ETsStatusType FreshBloodCalibrationForm::canShow()
{

}

void FreshBloodCalibrationForm::setParams(QVariant viewModel)
{
    if(viewModel.canConvert<FreshBloodViewModel>())
    {
        FreshBloodViewModel vModel = viewModel.value<FreshBloodViewModel>();
        //更新界面
        mFreshBloodViewModel = vModel;
    }
}

QVariant FreshBloodCalibrationForm::getParams()
{
   //return mFreshBloodViewModel;
}

void FreshBloodCalibrationForm::onStart(TsModel tsModel)
{
    if(tsModel.tsType == TsModeExchange){
        //提示正在进行模式切换。。对话框
    }else if(tsModel.tsType == TsCSaNeedleClean){
        //提示正在清洗采样针。。对话框
    }else if(tsModel.tsType == TsCount){
        //界面不响应其他交互
    }
}

void FreshBloodCalibrationForm::onSuccess(TsModel tsModel)
{
    if(tsModel.tsType == TsModeExchange){
        //提示模式切换成功，8s后自动关闭对话框
    }else if(tsModel.tsType == TsCSaNeedleClean){
        //提示采样针清洗成功，8s后自动关闭对话框
    }else if(tsModel.tsType == TsCount){
        //使能界面交互功能
    }
}

void FreshBloodCalibrationForm::onFailure(TsModel tsModel)
{
    if(tsModel.tsType == TsModeExchange){
        //提示模式切换失败，请先解决故障
    }else if(tsModel.tsType == TsCount){
        //使能界面交互功能，请先解决故障
    }
}

void FreshBloodCalibrationForm::onNoSupport(TsModel tsModel)
{
    //请先解决故障
}

void FreshBloodCalibrationForm::onSleep(TsModel tsModel)
{
    //休眠状态，按下吸样键会退出休眠，不需要提醒
    //nothing to do
}

void FreshBloodCalibrationForm::onExit(TsModel tsModel)
{
    //
}


void FreshBloodCalibrationForm::on_comboBox_sampNumber_currentIndexChanged(const QString &arg1)
{
    //设置样本编号参数，需要判断当前计数是否完成
}

void FreshBloodCalibrationForm::on_comboBox_bloodMode_currentIndexChanged(const QString &arg1)
{
    //设置血样模式
}

void FreshBloodCalibrationForm::on_Btn_freshBloodSave_clicked()
{

}

void FreshBloodCalibrationForm::on_Btn_ftest_clicked()
{

}

void FreshBloodCalibrationForm::on_Btn_calibrationCalculate_clicked()
{
    calibrationCalculateDialog = new CalibrationCalculateDialog(0, &mFreshBloodViewModel);
    int result = calibrationCalculateDialog->exec();
    if(result == QDialog::Accepted){

    }
}
